* --------------------
* Configuration
* --------------------

di "${d}"
*set date and time for log directory
* Get the current date and time

local current_time = c(current_time)

* Format the date and time to remove non-alphanumeric characters

global formatted_time = subinstr(subinstr("`current_time'", ":", "", .), " ", "", .)


* Display the combined date and time string
display "Current Time String: $formatted_time"

* Log config
global d "`1'"
local temp = subinstr("${d}", "/$", "", .)
global root_dir = "`temp'"
global log_dir "${d}logs/macrosim/"
cap shell mkdir "${log_dir}"
local kvers = "${bvers}"
log using "${log_dir}simulation_${bvers}_$formatted_time.log", replace name("$bvers")

*import the paths from the main config file
do ${d}code/config/config.do 
* --------------------*
* Data config   
global ln_vers "ln1P"
global ttt "bia"
global weight_window "_from1970"    
global tf "_tfacit1"


* Regression specification config
global chosen_spec "3J" 
global FE "FY" 

* Simulation config
global iwvers "divnearestsep" 
global osmtrim "trm10" 

*number of runs per batch we run 4 batches (0 to 3), JPE submission was N = 200
global N = 200

* Wage change config
global wagechange = 0.1 

* Output results config
global outd_root ${d}datasets/macrosim
global outdk ${outd_root}/keepspill
global outdr ${outd_root}/${iwvers}${osmtrim}
cap shell mkdir "$outdk"
cap shell mkdir "$outdr"

* Depreciation config, used in predict_patenting.do and recompute_spillovers.do default is 0.85
global deltadepreciation = 0.85 

*set globals for Samsung division year dummies (division because we run 2 regressions in 1)
global ssPFE = "ssdiv_year*"


* -------------------------------- *
* Parse regression specifications  *
* -------------------------------- *

local stockspill stockauto95 stockauto95zero stockpauto95 stockpauto95zero stockother stockotherzero spilloversauto95 spilloversauto95zero spilloverspauto95 spilloverspauto95zero spilloversother spilloversotherzero
local stockspillsquared `stockspill' sqspilloversauto95  sqspilloverspauto95 sqspilloversother 

global spec_3J ISP GDPGAP `stockspillsquared' ${ssPFE}

*setting the spec and the Fixed effects
global spec ${spec_${chosen_spec}}
global absorb firm_division division_yearindustry

* -------------------------------- *
* Display configuration
* -------------------------------- *

di "Parsed configuration:"
di "data: $ln_vers pauto95 $ttt $weight_window $tf" 
di "model: $chosen_spec $FE"
di "spillovers: $iwvers $osmtrim"
di "wage change: $wagechange"
di "runs: $N"
di "logging to: $log_dir"

